package com.wgh.demo.ai.controller;

import com.wgh.demo.ai.enums.AiModelType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/api/ai/models")
public class AiModelController {

    /**
     * 获取所有可用的AI模型列表
     * @return 包含AI模型列表的响应
     */
    @GetMapping
    public ResponseEntity<List<Map<String, String>>> getModelList() {
        // 将枚举转换为前端可用的列表
        List<Map<String, String>> modelList = Arrays.stream(AiModelType.values())
                .map(modelType -> Map.of(
                        "code", modelType.getCode(),
                        "name", modelType.getName()
                ))
                .collect(Collectors.toList());

        return ResponseEntity.ok(modelList);
    }
}